<?php

namespace common\models\db\tables;

use Yii;

/**
 * This is the model class for table "{{%spu_materials}}".
 *
 * @property int $id
 * @property int $spu_id
 * @property int $created_at
 * @property int $updated_at
 * @property int $deleted_at
 * @property int $created_by_adminer
 * @property int|null $updated_by_adminer
 * @property int $material_type
 * @property string|null $material_text
 * @property int|null $material_file_id
 * @property int $material_sort 素材排序
 */
class SpuMaterials extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%spu_materials}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['spu_id', 'created_at', 'updated_at', 'deleted_at', 'created_by_adminer', 'updated_by_adminer', 'material_type', 'material_text', 'material_file_id', 'material_sort'], 'trim'],
            [['spu_id', 'created_at', 'updated_at', 'created_by_adminer', 'material_type'], 'required'],
            [['spu_id', 'created_at', 'updated_at', 'deleted_at', 'created_by_adminer', 'updated_by_adminer', 'material_type', 'material_file_id', 'material_sort'], 'integer'],
            [['material_text'], 'string'],
            [['deleted_at'], 'default', 'value' => 0],
            [['updated_by_adminer', 'material_text', 'material_file_id'], 'default', 'value' => null],
            [['material_sort'], 'default', 'value' => 1],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'spu_id' => Yii::t('app', 'Spu ID'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
            'deleted_at' => Yii::t('app', 'Deleted At'),
            'created_by_adminer' => Yii::t('app', 'Created By Adminer'),
            'updated_by_adminer' => Yii::t('app', 'Updated By Adminer'),
            'material_type' => Yii::t('app', 'Material Type'),
            'material_text' => Yii::t('app', 'Material Text'),
            'material_file_id' => Yii::t('app', 'Material File ID'),
            'material_sort' => Yii::t('app', '素材排序'),
        ];
    }
}
